package demo2;

public class Test {
    public static void main(String[] args) {
        Dog dog = new Dog();
        Cat cat = new Cat();
        Animal animal = new Dog();
        if(animal instanceof Cat){
             cat = (Cat) animal;
             cat.mew();
        }
        if(animal instanceof Dog){
             dog = (Dog) animal;
             dog.bark();
        }
    }
}
